/*
 * @Description: 权限管理相关接口
 * @Author: Liu Kunpeng
 * @Date: 2021-07-19 20:14:59
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-08-16 11:18:23
 */
import request from '@/utils/request'
//添加权限分组
export function addRoleGroupApi(data){
    return request({
        url: '/admin/acl/roleGroup/addRoleGroup',
        method: 'post',
        data
    })
}
//添加角色
export function addRoleApi(data){
    return request({
        url: '/admin/acl/role/addRole',
        method: 'post',
        data
    })
}
//获取所有角色组
export function getAllRoleGroupApi(){
    return request({
        url: '/admin/acl/roleGroup/getAllRoleGroup',
        method: 'get',
    })
}
//获取所有角色
export function getAllRoleApi(){
    const queryInfo={
        query: "",
        pageNum: 1,
        pageSize: 100
    }
    return request({
        url: '/admin/acl/role/getAllRole',
        method: 'get',
        params: queryInfo
    })
}
//获取角色分组及其角色
export function getGroupAndRoleApi(){
    return request({
        url: '/admin/acl/roleGroup/getGroupAndRole',
        method: 'get',
    })
}
//修改角色分组
export function editGroupApi(data){
    return request({
        url: '/admin/acl/roleGroup/updateRoleGroup',
        method: 'put',
        data
    })
}
//修改角色
export function editRoleApi(data){
    return request({
        url: '/admin/acl/role/updateRole',
        method: 'put',
        data
    })
}
//删除角色分组
export function deleteGroupApi(id){
    return request({
        url: '/admin/acl/roleGroup/removeRoleGroup/' + id,
        method: 'delete',
    })
}
//删除角色
export function deleteRoleApi(id){
    return request({
        url: '/admin/acl/role/removeRole/' + id,
        method: 'delete',
    })
}
//获取所有权限(平级结构)
export function getAllPermissionsApi(){
    return request({
        url: '/admin/acl/permission/getAllPermissions',
        method: 'get',
    })
}

//根据当前用户获取权限菜单(树形结构)
export function getPermissionsMenuApi(){
    return request({
        url: '/admin/acl/index/getPermissionMenu',
        method: 'get',
    })
}
//为角色绑定权限
export function assignPermissionsApi(data){
    return request({
        url: '/admin/acl/permission/assignPermissions',
        method: 'post',
        data
    })
}
export function getPermissionByRoleIdApi(id){
    return request({
        url: '/admin/acl/permission/getPermissionsByRoleId/'+ id,
        method: 'get',
        
    })
}